/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package momo.impl;

import java.util.Collection;

import momo.Ellipse;
import momo.MomoPackage;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Ellipse</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link momo.impl.EllipseImpl#getMajorAxis <em>Major Axis</em>}</li>
 *   <li>{@link momo.impl.EllipseImpl#getMinorAxis <em>Minor Axis</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EllipseImpl extends SimplexImpl implements Ellipse {
	/**
	 * The cached value of the '{@link #getMajorAxis() <em>Major Axis</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMajorAxis()
	 * @generated
	 * @ordered
	 */
	protected EList<Double> majorAxis;

	/**
	 * The cached value of the '{@link #getMinorAxis() <em>Minor Axis</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMinorAxis()
	 * @generated
	 * @ordered
	 */
	protected EList<Double> minorAxis;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EllipseImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MomoPackage.Literals.ELLIPSE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Double> getMajorAxis() {
		if (majorAxis == null) {
			majorAxis = new EDataTypeUniqueEList<Double>(Double.class, this, MomoPackage.ELLIPSE__MAJOR_AXIS);
		}
		return majorAxis;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Double> getMinorAxis() {
		if (minorAxis == null) {
			minorAxis = new EDataTypeUniqueEList<Double>(Double.class, this, MomoPackage.ELLIPSE__MINOR_AXIS);
		}
		return minorAxis;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MomoPackage.ELLIPSE__MAJOR_AXIS:
				return getMajorAxis();
			case MomoPackage.ELLIPSE__MINOR_AXIS:
				return getMinorAxis();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MomoPackage.ELLIPSE__MAJOR_AXIS:
				getMajorAxis().clear();
				getMajorAxis().addAll((Collection<? extends Double>)newValue);
				return;
			case MomoPackage.ELLIPSE__MINOR_AXIS:
				getMinorAxis().clear();
				getMinorAxis().addAll((Collection<? extends Double>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MomoPackage.ELLIPSE__MAJOR_AXIS:
				getMajorAxis().clear();
				return;
			case MomoPackage.ELLIPSE__MINOR_AXIS:
				getMinorAxis().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MomoPackage.ELLIPSE__MAJOR_AXIS:
				return majorAxis != null && !majorAxis.isEmpty();
			case MomoPackage.ELLIPSE__MINOR_AXIS:
				return minorAxis != null && !minorAxis.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (majorAxis: ");
		result.append(majorAxis);
		result.append(", minorAxis: ");
		result.append(minorAxis);
		result.append(')');
		return result.toString();
	}

} //EllipseImpl
